package com.qidian.mes.md.controller;

import com.qidian.mes.md.service.MdItemTypeService;
import com.qidian.mes.pojo.MdItemType;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 32郗建狄
 * @Company GX631
 * Time 2023/11/2 10:32
 * Description
 */
@RestController
@RequestMapping("/itemType")
@CrossOrigin
public class MdItemTypeController {
    @Autowired
    private MdItemTypeService mdItemTypeService;
    @GetMapping("/list")
    public MESResult list(){
//        System.out.println("红红火火恍恍惚惚哈哈哈哈");
        return mdItemTypeService.getAll();
    }
    @GetMapping("/get")
    public MESResult get(Long itemTypeId){
        return mdItemTypeService.get(itemTypeId);
    }
    @PutMapping("/update")
    public MESResult update(@RequestBody MdItemType mdItemType){
        System.out.println(mdItemType);
        return mdItemTypeService.update(mdItemType);
    }
    @PostMapping("/save")
    public MESResult save(@RequestBody MdItemType mdItemType){
        System.out.println(mdItemType);
        return mdItemTypeService.save(mdItemType);
    }
    @DeleteMapping("/delete")
    public MESResult delete(Long itemTypeId){
        return mdItemTypeService.delete(itemTypeId);
    }
    @GetMapping("/search")
    public MESResult search( MdItemType mdItemType){
        System.out.println(mdItemType);
        return mdItemTypeService.searchByNameAndEnable(mdItemType);
    }
}
